<template>
	<view class='content'>
		<view style='height: 10px;'>
			
		</view>
		<u-cell-group class='top'>
			<u-cell icon='plus' title="添加收款方式" :isLink="true"  url="/pages/jifen/wxbind">
			
			</u-cell>
		</u-cell-group>
		
		<view class="cont">
			<view class='cont-item' v-for="(item,index) in list" :key="index">
				<u-cell-group>
					<u-cell icon="account-fill" title="收款人姓名" :value='item.username'></u-cell>
					<u-cell icon="phone-fill" title="手机号" :value="item.tel"></u-cell>
					<u-cell icon="phone-fill" title="收款二维码" value="解除绑定" @click='canlebind(item)'>
						
					</u-cell>
				</u-cell-group>
				<view class='upload'>
					<u-album singleSize='100' :urls="[list[index]]" keyName="img"></u-album>
				</view>
				
			</view>
	
		</view>
		
		<u-modal :show="show" title="提示" :show-cancel-button="true" @cancel="cancel" @confirm="confirm">
			<view class="slot-content">
				<view class="">
					确认要解除绑定吗?
				</view>
			</view>
		</u-modal>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				show: false,
				id: ''
			}
		},
		onLoad() {
			this.getlist()
		},
		methods: {
			getlist(){
				var _this = this
				uni.request({
					url: 'http://www.yndzfl.cn/wxsite/User/userWxPaylist',
					method: 'POST',
					header:{
						"Content-Type" : "application/x-www-form-urlencoded"
					},
					data: {
						openid: uni.getStorageSync('OPENID')
					},
					success(res) {
						console.log(res)
						if(res.data.code == 1){
							_this.list = res.data.data
						}
						
					}
				})
			},
			canlebind(item){
				this.show = true
				this.id = item.id
			},
			cancel(){
				this.show = false
			},
			confirm(){
				var _this = this
				uni.request({
					url: 'http://www.yndzfl.cn/wxsite/User/delWxpay',
					method: 'POST',
					header:{
						"Content-Type" : "application/x-www-form-urlencoded"
					},
					data: {
						openid: uni.getStorageSync('OPENID'),
						id: _this.id
					},
					success(res) {
						// console.log(res)
						_this.show = false
						if(res.data.code == 1){
							_this.getlist()
						}
						
					}
				})
			}
		}
	}
</script>

<style scoped>
.content{
	min-height: 100vh;
	background: #f6f6f6;
}
.top{
	background-color: #fff;
	/* margin: 15px 0; */
	/* margin-top: 10px; */
}
.cont{
	/* background-color: #fff; */
}
.cont-item{
	background-color: #fff;
	margin-top: 10px;
}
.upload{
	padding: 15px;
}
</style>
